# $Id: PKGBUILD 82753 2013-01-23 20:52:45Z bpiotrowski $
# Maintainer:  Bartłomiej Piotrowski <nospam@bpiotrowwski.pl>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: evr <evanroman at gmail>
# Contributor: Luiz Ribeiro <luizribeiro@gmail.com>

pkgname=mpdscribble
pkgver=0.22
pkgrel=6
pkgdesc='MPD client which submits track info to Last.fm'
url='http://mpd.wikia.com/wiki/Client:Mpdscribble'
arch=('i686' 'x86_64')
license=('GPL')
depends=('libsoup' 'glib2' 'libmpdclient')
install=$pkgname.install
source=(http://downloads.sourceforge.net/musicpd/mpdscribble-${pkgver}.tar.bz2
        service)
sha256sums=('1cde2b5f8c70f0e3e6f059d01bf0b0f2eac2b29fbcd14b01a8a5103e603feb41'
            '8a6568235e8b2ac7535a6f99f4401450a4162bac0cacb938af2ec39a808e1132')

build() {
  cd mpdscribble-$pkgver

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --with-http-client=soup

  make
}

package() {
  cd mpdscribble-$pkgver

  make DESTDIR="${pkgdir}" install

  install -Dm644 "${srcdir}"/service \
    "${pkgdir}"/usr/lib/systemd/system/mpdscribble.service

  # default config is really an example
  install -D -m644 "${pkgdir}"/etc/mpdscribble.conf \
    "${pkgdir}"/usr/share/mpdscribble/mpdscribble.conf.example
  rm -f "${pkgdir}"/etc/mpdscribble.conf

  install -d "${pkgdir}"/var/cache/mpdscribble
  touch "${pkgdir}"/var/cache/mpdscribble/mpdscribble.cache
}
